import gps from '../../utils/gps';
import Device from 'react-native-device-info';
import * as Localize from 'react-native-localize';

const brand = Device.getBrand();
const appVersion:string = Device.getVersion();
const systemName:string = Device.getSystemName();
const appName:string = Device.getApplicationName();
const systemVersion:string = Device.getSystemVersion();

export default async () => {
    const {
        latitude,
        longitude
    } = await gps();

    const Agents = [];

    //经纬度
    Agents.push(
        [longitude, latitude].join(`,`)
    )

    //App名称与版本号
    Agents.push(
        `${appName} ${appVersion}`
    )

    //系统信息
    Agents.push(
        `${brand} ${systemName} ${systemVersion}`
    )

    //户端时区
    Agents.push(Localize.getTimeZone());

    //客户端设备名
    Agents.push(
        encodeURIComponent(Device.getDeviceNameSync())
    )

    return Agents.join(`::`);
}

